home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
CD World 1998 January
/
CD World - Ocak 1998.iso
/
misc
/
dbase55
/
disk7
/
cbtsamp.pak
/
ANIMALS.WFM
< prev
next >
Wrap
Text File
|
1996-01-05
|
9KB
|
359 lines
*******************************************************************************
* PROGRAM: Animals.wfm
*
* WRITTEN BY: Borland Samples Group
*
* DATE: 1/94
*
* UPDATED: 5/95
*
* REVISION: $Revision: 2.83 $
*
* VERSION: Visual dBASE
*
* DESCRIPTION: This program shows the ability of Visual dBASE to traverse a
* table and display its contents in a form. The form created in
* this program has entryfields displaying names and habitats of
* different animals, pushbuttons that allow you to move to the
* next/previous animal or exit, and an image displaying the
* current animal.
*
* PARAMETERS: None
*
* CALLS: Buttons.cc (Custom Controls file)
* Animals.qbe (View of table -- you can also use Animsql.qbe,
* which uses local SQL to
* accomplish the same tasks)
*
* USAGE: DO Animals.wfm
*
********************************************************************************
create session
set talk off
set ldCheck off
** END HEADER -- do not remove this line*
* Generated on 05/23/95
*
parameter bModal
local f
f = new ANIMALSFORM()
if (bModal)
f.mdi = .F. && ensure not MDI
f.ReadModal()
else
f.Open()
endif
CLASS ANIMALSFORM OF FORM
Set Procedure to &_dbwinhome.samples\Buttons.cc Additive
this.OnOpen = CLASS::ONOPEN
this.OnClose = CLASS::ONCLOSE
this.View = "ANIMALS.QBE"
this.Text = "Animals"
this.Top = 0
this.Height = 13.1758
this.Width = 63.666
this.TopMost = .F.
this.PageNo = 1
this.OnNavigate = CLASS::ONNAVIGATE
this.Maximize = .F.
this.Minimize = .F.
this.Left = 20
this.OnSize = CLASS::ONSIZE
this.ColorNormal = "BtnFace"
DEFINE RECTANGLE INFORECTANGLE OF THIS;
PROPERTY;
Text "",;
Height 13.0195,;
Top 0.0977,;
Width 63.1357,;
PageNo 1,;
Left 0.1973,;
MousePointer 3,;
Border .T.,;
FontSize 6.5,;
BorderStyle 1,;
ColorNormal "BtnFace"
DEFINE TEXT TITLETEXT OF THIS;
PROPERTY;
FontName "Times New Roman",;
FontBold .F.,;
Text "Animals of the World",;
Top 0.5,;
Height 1.5586,;
Width 61.666,;
PageNo 1,;
Left 1,;
Border .F.,;
FontSize 22,;
ColorNormal "R/BtnFace",;
Alignment 4
DEFINE TEXT NAMETEXT OF THIS;
PROPERTY;
FontName "Arial",;
FontBold .F.,;
FontItalic .T.,;
Text "Name",;
Top 3.2344,;
Height 1.3535,;
Width 7,;
PageNo 1,;
Left 2,;
Border .F.,;
FontSize 10,;
ColorNormal "B/BtnFace",;
Alignment 5
DEFINE ENTRYFIELD NAMEENTRY OF THIS;
PROPERTY;
FontName "Arial",;
ColorHighLight "N/GB+",;
Top 3.2344,;
Height 1.3535,;
Width 16.502,;
Enabled .F.,;
PageNo 1,;
DataLink "NAME",;
Left 10.8311,;
Border .T.,;
FontSize 10,;
ColorNormal "N/GB+"
DEFINE TEXT SIZETEXT OF THIS;
PROPERTY;
FontName "Arial",;
FontBold .F.,;
FontItalic .T.,;
Text "Size",;
Top 4.7637,;
Height 1.2949,;
Width 7,;
PageNo 1,;
Left 2,;
Border .F.,;
FontSize 10,;
ColorNormal "B/BtnFace",;
Alignment 5
DEFINE ENTRYFIELD SIZEENTRY OF THIS;
PROPERTY;
FontName "Arial",;
ColorHighLight "N/GB+",;
Top 4.7637,;
Height 1.2949,;
Width 5.002,;
Enabled .F.,;
PageNo 1,;
DataLink "SIZE",;
Left 10.8311,;
Border .T.,;
FontSize 10,;
ColorNormal "N/GB+"
DEFINE TEXT WEIGHTTEXT OF THIS;
PROPERTY;
FontName "Arial",;
FontBold .F.,;
FontItalic .T.,;
Text "Weight",;
Top 6.2344,;
Height 1.3535,;
Width 7,;
PageNo 1,;
Left 2,;
Border .F.,;
FontSize 10,;
ColorNormal "B/BtnFace",;
Alignment 5
DEFINE ENTRYFIELD WEIGHTENTRY OF THIS;
PROPERTY;
FontName "Arial",;
ColorHighLight "N/GB+",;
Top 6.2344,;
Height 1.3535,;
Width 5.002,;
Enabled .F.,;
PageNo 1,;
DataLink "WEIGHT",;
Left 10.8311,;
Border .T.,;
FontSize 10,;
ColorNormal "N/GB+"
DEFINE TEXT AREATEXT OF THIS;
PROPERTY;
FontName "Arial",;
FontBold .F.,;
FontItalic .T.,;
Text "Area",;
Top 7.7637,;
Height 1.2949,;
Width 7,;
PageNo 1,;
Left 2,;
Border .F.,;
FontSize 10,;
ColorNormal "B/BtnFace",;
Alignment 5
DEFINE ENTRYFIELD AREAENTRY OF THIS;
PROPERTY;
FontName "Arial",;
ColorHighLight "N/GB+",;
Top 7.7637,;
Height 1.2949,;
Width 24.335,;
Enabled .F.,;
PageNo 1,;
DataLink "AREA",;
Left 10.8311,;
Border .T.,;
FontSize 10,;
ColorNormal "N/GB+"
DEFINE RECTANGLE IMAGERECT OF THIS;
PROPERTY;
Text "",;
Height 9.5488,;
Top 3.0977,;
Width 26.166,;
PageNo 1,;
Left 36.5,;
Border .T.,;
BorderStyle 2,;
ColorNormal "N/BtnFace"
DEFINE IMAGE ANIMALIMAGE OF THIS;
PROPERTY;
Top 3.1475,;
Height 9.4404,;
Width 25.6689,;
PageNo 1,;
Left 36.6641,;
DataSource "BINARY BMP"
DEFINE PREVBUTTON PREVANIMALBUTTON OF THIS;
PROPERTY;
Group .T.,;
Top 9.5,;
Height 1.5586,;
Width 14.168,;
OnClick CLASS::PREV_ONCLICK,;
Left 2.832
DEFINE NEXTBUTTON NEXTANIMALBUTTON OF THIS;
PROPERTY;
Group .T.,;
Top 9.5,;
Height 1.5586,;
Width 14.168,;
OnClick CLASS::NEXT_ONCLICK,;
Left 20.665
DEFINE CLOSEBUTTON CLOSEANIMALSBUTTON OF THIS;
PROPERTY;
Group .T.,;
Default .T.,;
Top 11.2988,;
Height 1.5244,;
Width 14.166,;
Left 11.5
DEFINE SAMPLEINFOBUTTON ANIMALSINFOBUTTON OF THIS;
PROPERTY;
Group .T.,;
Text "",;
Top 0.2998,;
Height 1.1699,;
Width 3.5,;
Left 59.5
PROCEDURE OnOpen
****************************************************************************
*** Do calculations in another workarea so form is not affected
use animals again in select() order name alias temp
go bottom in temp
form.lastRec = recno("temp")
go top in temp
form.firstRec = recno("temp")
use in temp
***
form.animalsInfoButton.sampleName = "Animals.wfm"
form.closeAnimalsButton.SetFocus()
****************************************************************************
PROCEDURE NEXT_OnClick
* Go to next record.
****************************************************************************
NEXTBUTTON::OnClick()
if recno() = form.lastRec && If on last record, move to prevButton
form.prevAnimalButton.setfocus()
endif
****************************************************************************
PROCEDURE PREV_OnClick
* Go to previous record.
****************************************************************************
PREVBUTTON::OnClick()
if recno() = form.firstRec && If on first record, move to nextButton
form.nextAnimalButton.setfocus()
endif
****************************************************************************
PROCEDURE OnNavigate
* If animal has size > 10, change background color of the size entryfield
* to red.
****************************************************************************
if size > 10
form.sizeEntry.colornormal = "gb+/r"
form.statusmessage = "Animal has size > 10."
else
form.sizeEntry.colornormal = "n/gb+"
form.statusmessage = ""
endif
****************************************************************************
PROCEDURE OnSize ( SizeType, NewWidth, NewHeight )
* Resize main form rectangle as the form is resized.
****************************************************************************
form.infoRectangle.height = max(NewHeight -.2, 0)
form.infoRectangle.width = max(NewWidth - .5, 0)
****************************************************************************
PROCEDURE OnClose
* Clean up.
****************************************************************************
close procedure &_dbwinhome.samples\Buttons.cc
ENDCLASS